<?=$this->header()?>


    <?=$this->menu("galleries")?>


    <h1><?=$this->message("label.header", _Gallery::BUNDLE)?></h1>


    <? /* Breadcrums route & user info display */ ?>
    <?=$this->route(
        $this->message("label.header", _Gallery::BUNDLE),    // Route display
        $this->galleryListForm,                              // ListForm (for user info, see float right)
        $this->galleries($this->galleryListForm)->getRows()) // The total amount of users
    ?>


    <? /* Show status messages */ ?>
    <?=$this->messages(_Core::BUNDLE)?>


    <? /* Show error messages */ ?>
    <?=$this->errors(null)?>


    <form id="<?=get_class($this->galleryListForm)?>"
          method="post"
          action="gallery/list"
          onsubmit="return confirmDelete('<?=$this->message("message.confirm.delete", _Core::BUNDLE)?>', this)">


        <? /* Show the Search & Filter Panel */ ?>
        <?=$this->panel(
            "gallery/edit",         // Add New URL
            $this->galleryListForm, // ListForm
            array(                  // Filter fields
                GalleryPeer::NAME=>$this->message("prompt.name", _Gallery::BUNDLE),
                GalleryPeer::MODIFIED_DATE=>$this->message("choose.modified", _Core::BUNDLE),
                GalleryPeer::INSERT_DATE=>$this->message("choose.created", _Core::BUNDLE),
                GalleryPeer::ACTIVE=>$this->message("choose.active", _Core::BUNDLE),
            ),
            false // No languages for this page.
        )?>


        <? /* Start output buffering in case there are no results */ ?>
        <?$this->start()?>


        <table class="list" cellspacing="0" cellpadding="0">
        <tr>
            <th class="checkbox"></th>
            <?/*<th class="narrow"></th>*/?>
            <th>
                <?=$this->TH(
                    $this->galleryListForm, // ListForm
                    GalleryPeer::NAME,      // Sort Field
                    $this->message("prompt.name", _Gallery::BUNDLE) // Header Name
                )?>
            </th>
            <th class="narrow">
                <?=$this->TH(
                    $this->galleryListForm, // ListForm
                    "imageCount",           // Sort Field
                    $this->message("label.images", _Gallery::BUNDLE) // Header Name
                )?>
            </th>
            <th class="narrow">
                <?=$this->TH(
                    $this->galleryListForm,                        // ListForm
                    GalleryPeer::MODIFIED_DATE,                    // Sort Field
                    $this->message("choose.modified", _Core::BUNDLE) // Header Name
                )?>
            </th>
            <th class="narrow">
                <?=$this->TH(
                    $this->galleryListForm,                        // ListForm
                    GalleryPeer::INSERT_DATE,                      // Sort Field
                    $this->message("choose.modified", _Core::BUNDLE) // Header Name
                )?>
            </th>
            <th class="narrow" title="<?=$this->message("title.active", _Core::BUNDLE)?>">
                <?=$this->TH(
                    $this->galleryListForm,                    // ListForm
                    GalleryPeer::ACTIVE,                       // Sort Field
                    $this->message("label.active", _Core::BUNDLE) // Header Name
                )?>
            </th>
            <th class="buttons"></th>
        </tr>

        <? foreach($this->galleries($this->galleryListForm)->getItems() as $gallery) { ?>

            <tr class="ctrl">
                <td class="checkbox">

                    <input type="checkbox"
                           name="items[]"
                           value="<?=$gallery->getGalleryId()?>"
                           <?=in_array($gallery->getGalleryId(), $this->galleryListForm->getItems()) ? " checked=\"checked\"" : ""?> />

                </td>
                <?/*<td>
                    <? if($gallery->getImageId() > 0): ?>
                    <a title="<?=$this->message("title.image", _Core::BUNDLE)?>" href="image?id=<?=$gallery->getImageId()?>">
                        <?=$this->thumbnail($gallery->getThumbnailId())?>
                    </a>
                    <? endif; ?>
                </td>*/?>
                <td><?=$this->truncateNicely($gallery->getName(), 30, 36, "...")?></td>
                <td title="Images">
                    <a title="Click to see the images for this gallery." href="gallery/image/list?id=<?=$gallery->getGalleryId()?>">
                        <?=$gallery->getImageCount()?>
                    </a>
                </td>
                <td title="<?=$this->message("title.modified", _Core::BUNDLE)?> <?=$gallery->getModifiedDate(_Core::FORMAT_DATETIME)?>">
                    <?=$gallery->getModifiedDate(_Core::FORMAT_DATE)?>
                </td>
                <td title="<?=$this->message("title.created", _Core::BUNDLE)?> <?=$gallery->getInsertDate(_Core::FORMAT_DATETIME)?>">
                    <?=$gallery->getInsertDate(_Core::FORMAT_DATE)?>
                </td>
                <td title="<?=$this->message("title.active", _Core::BUNDLE)?>">
                    <?=$this->message("label." . ($gallery->getActive() ? "yes" : "no"), _Core::BUNDLE)?>
                </td>
                <td class="buttons">

                    <input type="button"
                           onclick="to('gallery/edit?gallery->galleryId=<?=$gallery->getGalleryId()?>')"
                           class="button"
                           value="<?=$this->message("button.edit", _Core::BUNDLE)?>" />

                    <input type="button"
                           onclick="del(<?=$gallery->getGalleryId()?>, '<?=get_class($this->galleryListForm)?>')"
                           class="button"
                           value="<?=$this->message("button.delete", _Core::BUNDLE)?>" />

                </td>
            </tr>

        <? } ?>

        </table>


        <? /* Edit/Action Bar for checkboxed */ ?>
        <?=$this->edit(
            $this->galleryListForm, // ListForm
            array(                  // The actions
                "activate"=>$this->message("choose.activate", _Core::BUNDLE),
                "deactivate"=>$this->message("choose.deactivate", _Core::BUNDLE),
                "delete"=>$this->message("choose.delete", _Core::BUNDLE)
            )
        )?>


        <? /* End output buffering */ ?>
        <?$this->end(
            $this->galleryListForm,                            // ListForm
            $this->path()."gallery/edit",                      // Add New URL
            $this->galleries($this->galleryListForm)->getRows() // The total amount of users
        )?>


    </form>

<?=$this->footer()?>